import { Color } from "cc";

export interface PatternConfig {
    name: string;
    pixelSize: number; // 每个像素的实际大小（像素）
    pattern: number[][]; // 二维数组，1表示有像素，0表示透明
    pixelColor: [number, number, number, number]; // RGBA 像素颜色
    backgroundColor: [number, number, number, number]; // RGBA 背景颜色
}

// 配置表：基于二维数组定义图案
export const patternConfigs: { [key: string]: PatternConfig } = {
    'L': {
        name: 'L字型',
        pixelSize: 20, // 每个逻辑像素对应20x20实际像素
        pattern: [
            [1, 0, 0],
            [1, 0, 0],
            [1, 0, 0],
            [1, 1, 1]
        ],
        pixelColor: [255, 0, 0, 255], // 红色
        backgroundColor: [0, 0, 0, 0] // 透明背景
    },
    'T': {
        name: 'T字型',
        pixelSize: 25,
        pattern: [
            [1, 1, 1],
            [0, 1, 0],
            [0, 1, 0],
            [0, 1, 0]
        ],
        pixelColor: [0, 255, 0, 255], // 绿色22
        backgroundColor: [0, 0, 0, 0] // 透明背景
    },
    'I': {
        name: 'I字型',
        pixelSize: 30,
        pattern: [
            [1],
            [1],
            [1],
            [1]
        ],
        pixelColor: [0, 0, 255, 255], // 蓝色
        backgroundColor: [0, 0, 0, 0] // 透明背景
    },
    'SQUARE': {
        name: '正方形',
        pixelSize: 15,
        pattern: [
            [1, 1, 1, 1],
            [1, 0, 0, 1],
            [1, 0, 0, 1],
            [1, 1, 1, 1]
        ],
        pixelColor: [255, 255, 0, 255], // 黄色
        backgroundColor: [0, 0, 0, 0] // 透明背景
    },
    'HEART': {
        name: '心形',
        pixelSize: 30,
        pattern: [
            [0, 1, 0, 1, 0],
            [1, 1, 1, 1, 1],
            [1, 1, 1, 1, 1],
            [0, 1, 1, 1, 0],
            [0, 0, 1, 0, 0]
        ],
        pixelColor: [255, 0, 128, 255], // 粉色
        backgroundColor: [0, 0, 0, 0]
    }
};

//采样颜色列表
export const sampleColorList = [
    {color: [Color.BLACK, Color.WHITE, Color.BLACK, Color.BLACK],outline: new Color('b53338'), type: 0},
    {color: [new Color('c8363c'), new Color('c43d43'), new Color('b72c32'), new Color('dc484f')], outline: new Color('b53338'), type: 1}, //红
    {color: [new Color('e0b828'), new Color('d7a938'), new Color('d39d18'), new Color('edc050')], outline: new Color('d3a535'), type: 2}, //黄 
    {color: [new Color('41d5fe'), new Color('35c2eb'), new Color('17a9fd'), new Color('3db2f5')], outline: new Color('43bfe5'), type: 3}, //浅蓝
    {color: [new Color('4360f6'), new Color('3854e3'), new Color('293ff2'), new Color('364aee')], outline: new Color('43bfe5'), type: 4}, //深蓝
    {color: [new Color('21ba31'), new Color('29aa33'), new Color('139f1d'), new Color('19a623')], outline: new Color('1fb22e'), type: 5}, //绿
    {color: [new Color('fc7e17'), new Color('e96d2f'), new Color('fb5907'), new Color('ec631e')], outline: new Color('e3752d'), type: 6}, //橙
    {color: [new Color('9353e9'), new Color('733de9'), new Color('622bdb'), new Color('6a33e3')], outline: new Color('8956cc'), type: 7}, //紫
    {color: [new Color('ed58c1'), new Color('e746b7'), new Color('db2ba7'), new Color('dc37ab')], outline: new Color('cd41a4'), type: 8}, //粉
    {color: [Color.BLACK, Color.WHITE, Color.BLACK, Color.BLACK],outline: new Color('b53338'), type: 0}, //占位
]